/**
  @file     	DESIGNPATTERN_Singleton.cpp 
  @brief    	To ensure that a class has only one instance
  @author  	arvin
  @version 	1.0   2012/12/12
 */
#include "stdafx.h"

#ifndef CXX_DESIGNPATTERN_SINGLETON_H
#include "DESIGNPATTERN_Singleton.h"
#endif

Singleton* Singleton::m_pInstance = NULL;


/**
* Construction
*
* @param VOID
* @return 
*/
Singleton::Singleton()
{
	DEBUG_PRINTF("");
}

/**
* Destruction
*
* @param VOID
* @return 
*/
Singleton::~Singleton()
{
	DEBUG_PRINTF("");
}

/**
* Instance
*
* @param VOID
* @return Singleton*
* @note Singleton
*/
Singleton* 
Singleton::Instance()
{
	DEBUG_PRINTF("");
	if (NULL == m_pInstance) {
		m_pInstance = new Singleton;
	}
	return m_pInstance;
}


/**
* Destroy
*
* @param VOID
* @return VOID
* @note singleton
*/
VOID 
Singleton::Destroy()
{
	DEBUG_PRINTF("");
	if (NULL != m_pInstance) {
		delete m_pInstance;
		m_pInstance = NULL;
	}
}

/* EOF */